﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ExtBusiness.Interface;
using ExtBusiness;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session.Clear();
        }
    }


    //protected void btnLogin_Click(object sender, EventArgs e)
    //{
    //    if (Session["CheckCode"] == null)
    //    {
    //        return;
    //    }
    //    //登录时验证码不区分大小写 addby zhongjian 20091125
    //    string CheckCode = txtCheckCode.Text.ToLower();
    //    string strCheckCode = Session["CheckCode"].ToString();
    //    strCheckCode = strCheckCode.ToLower();
    //    if (CheckCode != strCheckCode)　　//验证码
    //    {
    //        ClientScript.RegisterStartupScript(this.GetType(), "scr", string.Format(@"<script>alert('验证码不正确！');</script>"));
    //    }
    //    else
    //    {
    //        SaveCookie();

    //        string loginName = txtUserName.Text.ToUpper();
    //        string password = txtPassword.Text;
            
    //        Defult_DL dl = new Defult_DL();

    //        DataSet dsOut = dl.Dl(loginName, password);

    //        if (dsOut.Tables[0].Rows.Count > 0)//登陆成功
    //        {
    //            DataRow dr = dsOut.Tables[0].Rows[0];

    //            string gid = dl.Dl_gid(dr["userid"].ToString());

    //            Session.Add("UserId", dr["userid"]);
    //            Session.Add("UserName", dr["user_name"]);
    //            Session.Add("RealUserId", loginName);
    //            Session.Add("Password", password);
    //            Session.Add("GroupId", gid);
    //            Session["UserName"] = dr["user_name"].ToString();
    //            Session["dpid"] = Request["usergroup1"];

    //            //添加考勤记录
    //            User.UserKaoQing.SaveUserLog(dr["userid"].ToString());
    //            Response.Redirect("index.aspx");
    //        }
    //        else //失败
    //        {
    //            Response.Write("<script language=javascript>alert('密码不正确,请确认并重新输入正确的密码！');</script>");
    //        }
    //    }
    //}

    //protected void SaveCookie()
    //{
    //    HttpCookie cookie = new HttpCookie("UserInfo");
    //    if (Request["usergroup1"] != null && Request["user"] != null && Request["usergroup"] != null)
    //    {
    //        cookie["CName"] = Request["user"].ToString();

    //        TimeSpan ts = new TimeSpan(30, 0, 0, 0);//存储时间
    //        cookie.Expires = DateTime.Now.Add(ts);//添加时间到cookie中 
    //        Response.Cookies.Add(cookie);
    //    }
    //}
}
